﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YJKColumnModify.ConnectColumnBream
{
	public class BreamInfo
	{
		public BreamInfo(ExternalCommandData commandData, FamilyInstance bream, ViewPlan breamViewPlan)
		{
			this.m_commandData = commandData;
			this.m_uiDoc = commandData.Application.ActiveUIDocument;
			this.m_doc = this.m_uiDoc.Document;
			this.m_breamViewPlan = breamViewPlan;
			this.Bream = bream;
		}

		public FamilyInstance Bream
		{
			get
			{
				return this.m_bream;
			}
			set
			{
				this.m_bream = value;
				this.Init();
			}
		}

		public Level BreamLevel
		{
			get
			{
				return this.m_breamLevel;
			}
		}

		public Line BreamLocation
		{
			get
			{
				return this.m_breamLocation;
			}
		}

		public ViewPlan BreamViewPlan
		{
			get
			{
				return this.m_breamViewPlan;
			}
		}

		public ExternalCommandData ThisExternalCommandData
		{
			get
			{
				return this.m_commandData;
			}
		}

		public void Init()
		{
			this.m_breamLocation = ((this.m_bream.Location as LocationCurve).Curve as Line);
            this.m_breamLevel = (this.m_doc.GetElement(this.m_breamViewPlan.GetViewRange().GetLevelId((PlanViewPlane)2)) as Level);
		}

		private FamilyInstance m_bream;

		private Line m_breamLocation;

		private Level m_breamLevel;

		private ViewPlan m_breamViewPlan;

		private ExternalCommandData m_commandData;

		private UIDocument m_uiDoc;

		private Document m_doc;
	}
}
